package com.stress.testing.common;

import com.stress.testing.common.conf.AgentConfig;

import java.lang.instrument.Instrumentation;
import java.net.URL;
import java.util.List;
import java.util.Map;

public class DefaultAgentContext implements AgentContext {

    private AgentConfig agentConfig;
    private List<URL> extendLibURL;
    private List<URL> agentDependenceURL;
    private Map<String, List<URL>> agentPluginURL;
    private Instrumentation inst;
    private ClassLoader agentExtendJarClassLoader;
    private String agentPluginPath;

    public DefaultAgentContext(AgentConfig agentConfig, List<URL> extendLibURL, List<URL> agentDependenceURL,
                               Map<String, List<URL>> agentPluginURL, Instrumentation inst,
                               ClassLoader agentExtendJarClassLoader, String agentPluginPath) {
        this.agentConfig = agentConfig;
        this.extendLibURL = extendLibURL;
        this.agentDependenceURL = agentDependenceURL;
        this.agentPluginURL = agentPluginURL;
        this.inst = inst;
        this.agentExtendJarClassLoader = agentExtendJarClassLoader;
        this.agentPluginPath = agentPluginPath;
    }

    @Override
    public AgentConfig getAgentConfig() {
        return agentConfig;
    }

    @Override
    public String getClassFileTransformerRegistryClass() {
        return agentConfig.getClassFileTransformerRegistryClass();
    }

    @Override
    public List<URL> getExtendLibURL() {
        return extendLibURL;
    }

    @Override
    public List<URL> getAgentDependenceURL() {
        return agentDependenceURL;
    }

    @Override
    public Map<String, List<URL>> getAgentPluginURL() {
        return agentPluginURL;
    }

    @Override
    public String getAgentPluginPath() {
        return agentPluginPath;
    }

    @Override
    public Instrumentation getInstrumentation() {
        return inst;
    }

    @Override
    public ClassLoader getAgentExtendJarClassLoader() {
        return agentExtendJarClassLoader;
    }
}
